
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
/**动画帧事件脚本 */
@ccclass('RoleAnimFrameEvent')
export class RoleAnimFrameEvent extends Component {


    protected role: any = null;
    public setRole(role) {
        this.role = role;
    }

    /**攻击判定效果开始 */
    public atkStart() {
        this.role.animAtkStart();
    }
    /**攻击判定效果结束 */
    public atkEnd() {
        this.role.animAtkEnd();
    }
    /**播放音效 */
    public playAudio(clip?: string) {
        if (this.role.isPlayer) {
            this.role.animPlayAudio(clip);
        }
    }
    /**
     * 播放特效
     * @param effect 特效预制件名称
     */
    public playEffect(effect?: string) {
        this.role.animPlayEffect(effect);
    }
    /**
     * 屏幕震动
     */
    public shake() {
        if (this.role.isPlayer) {
            this.role.animShake();
        }
    }

}
